package com.example.taobao;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        Intent intent = getIntent();
        int position = intent.getIntExtra("position",1) + 1;
        ImageView imageView = (ImageView) findViewById(R.id.image);
        switch (position){
            case 1: case 5: imageView.setImageResource(R.drawable.macs);break;
            case 2: case 6: imageView.setImageResource(R.drawable.minis);break;
            case 3: case 7: imageView.setImageResource(R.drawable.pros);break;
            case 4: case 8: imageView.setImageResource(R.drawable.watchs);break;

        }

    }
}